package com.hc.session.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * @Author: huangcheng
 * @CreateTime: 2023-09-15  11:08
 * @Description:
 * @Version: 1.0
 */
@RestController
public class SpringSessionController {
    @GetMapping("put")
    public void test2(HttpServletRequest request, HttpSession session){
        session.setAttribute("test","wei");
        System.out.println(request.getRequestURL());
    }

    @GetMapping("get")
    public void test3(HttpServletRequest request, HttpSession session){
        System.out.println(request.getRequestURL()+":"+session.getAttribute("test"));
    }
}
